<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('班级选课信息')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="selectCourse()" >
                    <i class="fa fa-plus"></i>选课
                </a>
                <form action="" id="fm">
	                <input id="classId"   name="id" type="hidden" th:value="${classInfo.id}"> 
	                <input id="className" name="name" type="hidden" th:value="${classInfo.name}">
	                <input id="courseIds" name="courseIds" type="hidden">
                </form>             
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('course:classInfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('course:classInfo:remove')}]];
        var statusDatas = [[${@dict.getType('wct_class_staus')}]]; 
        var prefix = ctx + "course/classInfo";   
        var classId=[[${classInfo.id}]]
        	
        $(function() {
            var options = {
                url: prefix + "/classCourseList/"+classId,                
                modalName: "班级选课信息",
                columns: [{
                    checkbox: true
                },                
                {
                    field: 'id', 
                    title: '编号'
                },
                {
                    field: 'name', 
                    title: '课程名称'
                },
                {
                    field: 'typeName', 
                    title: '课程分类名称'
                },
                {
                    field: 'price', 
                    title: '课程价格'
                },
                {
                    field: 'teacherName', 
                    title: '课程主讲老师'
                }]
            };
            $.table.init(options);
        });
        
        
        /*
        * 班级选择课程...
        */
        function selectCourse(){
        	var $trs=$("tr.selected");
        	if($trs.size()>0){       	
        	var courseIds="";
        	$trs.each(function(){        		
        		courseIds +=$(this).find("td:eq(1)").text()+",";
        	});
        	//#console.log(courseIds);
        	$("#courseIds").val(courseIds);
        	//获取课程的编号.....
        	$.operate.save(prefix + "/selectClassCourse", $('#fm').serialize());
        	}else{
        		$.modal.alert("请选择课程!");        		
        	}
        }
        
        
        
    </script>
</body>
</html>